<?php
// +----------------------------------------------------------------------
// | 中间件 - 路由TOKEN认证
// +----------------------------------------------------------------------
declare(strict_types=1);

namespace app\middleware;

use app\model\SystemUsersModel;
use app\service\JwtTokenService;
use app\Request;

class RouteTokenAuthorize
{
    /**
     * 处理请求
     *
     * @param Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        if (!$request->getUserId()) {
            abort(401, '认证失败：授权无效或已过期');
        }
        return $next($request);
    }
}
